package com.woniuxy02;

import java.util.*;

public class Test07 {
    public static void main(String[] args) {
        //班级：学生集合
        List<Student> class1 = new ArrayList<Student>();
        class1.add(new Student(1,"zs",11));
        class1.add(new Student(2,"ls",11));
        List<Student> class2 = new ArrayList<Student>();
        class2.add(new Student(3,"aa",11));
        class2.add(new Student(4,"bb",11));
        class2.add(new Student(5,"ccc",11));
        //学校:班级集合
        Map<String,List<Student>> map = new HashMap<String,List<Student>>();
        map.put("class001",class1);
        map.put("class002",class2);
        //遍历
        Set<Map.Entry<String, List<Student>>> entries = map.entrySet();
        for(Map.Entry<String, List<Student>> entry : entries){
            System.out.println(entry.getKey());
            List<Student> students = entry.getValue();
            for (Student student: students){
                System.out.println(student);
            }
        }
    }
}
